﻿package mortal.game.manager.window3d
{
    import __AS3__.vec.*;
    import baseEngine.basic.*;
    import baseEngine.core.*;
    import flash.geom.*;

    public class Rect3DMask extends Object
    {
        private var _clipRect:Rectangle;
        public var modlelocalPos:Point;
        public var renderList:RenderList;

        public function Rect3DMask()
        {
            this._clipRect = new Rectangle();
            this.modlelocalPos = new Point();
            this.renderList = new RenderList();
            return;
        }// end function

        public function get clipRect() : Rectangle
        {
            return this._clipRect;
        }// end function

        public function set clipRect(param1:Rectangle) : void
        {
            this._clipRect.setTo(param1.x, param1.y, param1.width, param1.height);
            return;
        }// end function

        public function moveRect(param1:Rectangle, param2:Rectangle) : void
        {
            var _loc_3:* = this.modlelocalPos.x + param1.x;
            var _loc_4:* = this.modlelocalPos.y + param1.y;
            this._clipRect.x = _loc_3;
            this._clipRect.y = _loc_4;
            return;
        }// end function

        public function render(param1:Scene3D) : void
        {
            var _loc_5:Layer3DSort = null;
            var _loc_6:Vector.<Mesh3D> = null;
            var _loc_7:int = 0;
            var _loc_8:int = 0;
            var _loc_9:Mesh3D = null;
            param1.context.setScissorRectangle(this._clipRect);
            var _loc_2:* = this.renderList.layers;
            var _loc_3:* = _loc_2.length;
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3)
            {
                
                _loc_5 = _loc_2[_loc_4];
                if (_loc_5.isActive)
                {
                    _loc_5.sort();
                }
                _loc_6 = _loc_5.list;
                _loc_7 = _loc_6.length;
                if (_loc_7 > 0)
                {
                    _loc_8 = 0;
                    while (_loc_8 < _loc_7)
                    {
                        
                        _loc_9 = _loc_6[_loc_8];
                        _loc_9.draw(false);
                        _loc_8++;
                    }
                }
                _loc_4++;
            }
            param1.context.setScissorRectangle(null);
            return;
        }// end function

    }
}
